package com.hps.kafka.service;

import com.hps.kafka.component.KafkaSender;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @author heps
 * @date 2019/4/8 17:47
 */
@Service
public class MessageService {

    private KafkaSender kafkaSender;

    public MessageService(KafkaSender kafkaSender) {
        this.kafkaSender = kafkaSender;
    }

    public void sendMessage() {
        String content = "Hello! Kafka! " + System.currentTimeMillis();
        kafkaSender.send(content);
    }
}
